package top.shiyiri.shops.controller;

import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import top.shiyiri.shops.bean.*;
import top.shiyiri.shops.service.*;

import java.util.List;

/**
 * @author Aunean
 * @date 2021/12/30
 */
@Controller
public class AllShowController {

    @Autowired
    private TotalCountService service;
    @Autowired
    private SexCountService sexService;
    @Autowired
    private ProUsersTop3Service usersTop3Service;
    @Autowired
    private ProTotalCountService proTotalCountService;
    @Autowired
    private CateParTop10Service cateParTop10Service;
    @Autowired
    private EraParcaseCountService eraParcaseCountService;
    @Autowired
    private TimeCountService timeCountService;

    @ResponseBody
    @RequestMapping("/admin/total/findPV")
    public Integer findPV1() {

        int lines = service.findPV();
//        System.out.println(lines);
        return lines;
    }

    @RequestMapping("/admin/total/findSexUserCount")
    @ResponseBody
    public String findSexUserCount() {
        List<SexCount> list = sexService.findSexCount();
        return JSONObject.toJSONString(list);
    }

    @RequestMapping("/admin/total/proUsersTop3_2")
    @ResponseBody
    public String proUsersTop3() {
        List<ProUsersTop3> list = usersTop3Service.proUsersTop3();
        return JSONObject.toJSONString(list);
    }


    @RequestMapping("/admin/total/proTotalCount_2")
    @ResponseBody
    public String proTotalCount() {
        List<ProTotalCount> list = proTotalCountService.proTotalCount();
        return JSONObject.toJSONString(list);
    }


    @RequestMapping("/admin/total/cateParTop10_2")
    @ResponseBody
    public String cateParTop10() {
        List<CateParTop10> list = cateParTop10Service.catParTop10();
        return JSONObject.toJSONString(list);
    }

    @RequestMapping("/admin/total/earParcaseCount_2")
    @ResponseBody
    public String earParcaseCount() {
        List<EraCount> list = eraParcaseCountService.eraParchaseCount();
        return JSONObject.toJSONString(list);
    }

    @RequestMapping("/admin/total/proTotalCount_21")
    @ResponseBody
    public String proTotalCount_21() {
        List<ProTotalCount> list = proTotalCountService.proTotalCount2();
        return JSONObject.toJSONString(list);
    }

    @RequestMapping("/admin/total/timeAllCount_2")
    @ResponseBody
    public String timeAllCount_2() {
        List<TimeCount> list = timeCountService.timeAllCount();
        return JSONObject.toJSONString(list);
    }

}
